package org.webscale.json;
import org.apache.log4j.Logger;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class AllRequestFilter implements Filter{
	private static final Logger log = Logger.getLogger(AllRequestFilter.class);
	private FilterConfig filterConfig;


	public void destroy() {
		// TODO Auto-generated method stub

	}


	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain filterChain) throws IOException, ServletException {
		log.info("Log filter processed a "	+ getServletConfig().getInitParameter("logType") + " request");
		filterChain.doFilter(request, response);
	}

	private FilterConfig getServletConfig() {
		return filterConfig;
	}


	public void init(FilterConfig arg0) throws ServletException {
		filterConfig = arg0;
	}

}
